package cn.dy.sbo.dao;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Component;
import org.springside.modules.orm.hibernate.HibernateDao;

import cn.dy.sbo.api.FlowTypeDao;
import cn.dy.sbo.model.FlowType;
import cn.dy.sbo.vo.DropListVO;

@Component
public class FlowTypeDaoHibernate extends HibernateDao<FlowType, Long> implements FlowTypeDao{

	@SuppressWarnings("unchecked")
	@Override
	public List<DropListVO> getByCat(Long id) {
		Query query = super.getSession().createQuery("select id as id,code as code,name as name,enname as enname from FlowType where cat.id= " + id);
		List<DropListVO> list = null;
		try{
		list = (List<DropListVO>) query.setResultTransformer(Transformers.aliasToBean(DropListVO.class)).list();
		}catch(Exception e){
			e.printStackTrace();
		}
		return list;
	}

}
